<template>
  <div class="approval-container">
    <component
      :is="curComponent"
      v-bind="props"
      :is-audit="true"
      :isBatch="isBatch"
      :is-need-details="true"
    />
  </div>
</template>

<script>
import BaseAudit from './components/BaseAudit'
import TotalPackageAudit from './components/totalPackage/TotalPackageAudit'
import TotalPackageBaseChangeAudit from './components/totalPackage/TotalPackageBaseChangeAudit'
import OtherTypeContractAudit from '@/views/matters/approval/components/legal/OtherTypeContractAudit'
import RiskAudit from '@/views/matters/approval/components/legal/RiskAudit'
import RiskFeedbackAudit from '@/views/matters/approval/components/legal/RiskFeedbackAudit'
import ClaimFeedbackAudit from '@/views/matters/approval/components/legal/ClaimFeedbackAudit'
import OrgStructureAudit from '@/views/matters/approval/components/OrgStructureAudit'
import PreAcceptanceAudit from '@/views/matters/approval/components/PreAcceptanceAudit'
import AuditorApproval from '@/views/technical/ShiGroup/Approval/auditorApproval'

const columnAssment = [
  {
    title: '序号',
    dataIndex: 'serial',
    width: '5%',
    scopedSlots: { customRender: 'serial' }
  },
  {
    title: '附件名称',
    dataIndex: 'fileName',
    width: '35%'
  },
  {
    title: '附件格式',
    dataIndex: 'suffixName',
    width: '35%'
  },
  {
    title: '操作',
    key: 'action',
    width: '20%',
    scopedSlots: { customRender: 'action' }
  }
]

export default {
  components: {
    OtherTypeContractAudit,
    BaseAudit,
    TotalPackageAudit,
    TotalPackageBaseChangeAudit,
    RiskAudit,
    RiskFeedbackAudit,
    ClaimFeedbackAudit,
    OrgStructureAudit,
    PreAcceptanceAudit,
    AuditorApproval,
    CommentFeedbackAudit: () => import('@/views/matters/approval/components/legal/CommentFeedbackAudit'),
    CaseFeedbackAudit: () => import('@/views/matters/approval/components/legal/CaseFeedbackAudit'),
    Warning: () => import('@/views/matters/approval/components/warning'),
    ProductionRecords: () => import('@/views/matters/approval/components/ProductionRecords')
  },
  data() {
    return {
      columnAssment,
      dataAssement: [],
      curComponent: '',
      id: '',
      form: {},
      props: {},
      isBatch:false, //是否批量审批
    }
  },
  created() {
    let businessType = this.$route.query.businessType
    let qualityUnitNode = this.$route.query.qualityUnitNode
    let { taskDefKey } = this.$route.query
    // console.log(businessType)
    if (taskDefKey === 'office_archives_tjrcl' && businessType == 904) {
      this.props = { detailType: '1' }
      this.curComponent = () => import('@/views/office/archivesBorrowing/archivesBorrowingEdit')
    } else if (businessType == '406' && qualityUnitNode == '3') {
      this.curComponent = 'PreAcceptanceAudit'
    } else if (businessType === '1102' || businessType === 1102) {
      this.curComponent = 'TotalPackageAudit'
    } else if (businessType === '1118' || businessType === 1118) {
      this.curComponent = 'TotalPackageAudit'
    } else if (businessType === '1117' || businessType === 1117) {
      this.curComponent = 'TotalPackageAudit'
    } else if (businessType === '1111' || businessType === 1111) {
      this.curComponent = 'TotalPackageBaseChangeAudit'
    } else if (businessType === '1114' || businessType === 1114) {
      this.curComponent = 'RiskAudit'
    } else if (businessType === '1115' || businessType === 1115) {
      this.curComponent = 'RiskFeedbackAudit'
    } else if (businessType === '1006' || businessType === 1006) {
      this.curComponent = 'ClaimFeedbackAudit'
    } else if (businessType === '1007' || businessType === 1007) {
      this.curComponent = 'CommentFeedbackAudit'
    } else if (businessType === '1008' || businessType === 1008) {
      this.curComponent = 'CaseFeedbackAudit'
    } else if (taskDefKey === 'GS_SJGLZXZR_AUDIT' && businessType == 605) {
      this.curComponent = () => import('./components/design/DesignDataApproval')
    } else if (taskDefKey === 'FGS_ZGCS_CHOOSE' && businessType == 601) {
      this.curComponent = () => import('./components/design/DesignRequestApplicationSubCompanyBoss')
    } else if (taskDefKey === 'GS_SJGLZX_BMJL_CHOOSE' && businessType == 601) {
      this.curComponent = () => import('./components/design/DesignRequestApplicationSubCompanyBoss')
    } else if (taskDefKey === 'FGS_RYZC_AUDIT' && businessType == 601) {
      this.curComponent = () => import('./components/design/DesignRequestApplicationSubCompanyPeople')
    } else if (taskDefKey === 'GS_SJGLZX_BMJL_AUDIT' && businessType == 611) {
      this.curComponent = () => import('@/views/design/deepDesign/planningManagement/audit')
    } else if (taskDefKey === 'CO_SJZXBMJL_AUDIT' && businessType == 612) {
      this.curComponent = () => import('./components/design/DesignOutcomeManagement')
    } else if ((taskDefKey === 'XMB_XMJL_AUDIT' || taskDefKey === 'FGS_GSGLB_BMJL_AUDIT' || taskDefKey === 'GS_GCGLB_BMJL_AUDIT') && (Number(businessType) == 120 || Number(businessType) == 121)) {
      // 工程预警
      let approvalArr = localStorage.getItem('approvalArr') || null;
      //存在就为批量审批
      if(approvalArr){
        this.curComponent = 'BaseAudit'
      }else{
         this.curComponent = 'Warning'
      }
    } else if (taskDefKey === 'XMB_XMJL_AUDIT' && Number(businessType) == 122) {
      console.log('122')
      this.curComponent = 'ProductionRecords'
    } else if (Number(businessType) == 24001) {
      this.curComponent = 'OrgStructureAudit'
    }else if (Number(businessType) == 809 || Number(businessType) == 810 || Number(businessType) == 811 || Number(businessType) == 812) {
      this.curComponent ='AuditorApproval'
    }
    else {
      this.curComponent = 'BaseAudit'
      // this.curComponent = 'OtherTypeContractAudit'
    }
    this.id = this.$route.query.id
    let approvalArr = localStorage.getItem('approvalArr') || null;
    this.isBatch = approvalArr?true:false;
  }
}
</script>

<style>
</style>
